/**
 *@author readkid
 *@dependence jquery 1.2
 *@since 2010/1/15
 *@version 1.0
 */ 
(function () {
	//using namespace $.suning;
	$.suning || ($.suning = {});
	//Extends
	$.suning.extend = function (subClass, superClass) {
		var F = function() {};
		F.prototype = superClass.prototype;
		subClass.prototype = new F();
		superClass.prototype.constructor = superClass;
		subClass.prototype.constructor = subClass;
		subClass.base = superClass.prototype;
	}
})();



//SideNav
$.suning.MenuNav = function() {
	var timer;
	if($("#SideNav").css("display") == "none"){
		$(".sn_Menu").hover(function(){
			clearInterval(timer);					 
			$("#SideNav").css("display","block");	
			$(this).find(".sn_Menuicon").addClass("on");
						
			$("#SideNav").find("dl").each(function(i){
				$(this).mouseover(function() {
					navshow(i);
				});				   
			});
			
			function navshow(i){
				$("#SideNav").find(".icon").removeClass('on').eq(i).addClass("on");
				$("#SideNav").find(".sidenavchild").hide().eq(i).show();
			};
			
		},function(){
			timer = setInterval(function(){
				$("#SideNav").css("display","none");
			},1);
			$("#SideNav").find(".icon").removeClass('on');	
			$(this).find(".sn_Menuicon").removeClass("on");
			$(this).find(".sidenavchild").hide();
		});
		
	}else{	
		$("#SideNav").find("dl").each(function(i){
			$(this).mouseover(function(){
				$(this).find(".icon").addClass("on");	
				$(this).find(".sidenavchild").css("display","block");
			}).mouseout(function(){
				$(this).find(".icon").removeClass("on");	
				$(this).find(".sidenavchild").css("display","none");				
			})										   
		});		
	}
	
}









var Bgscroll = function(){
	var box = $('#pageBg');
	var isIE=!!window.ActiveXObject;
	var isIE6=isIE&&!window.XMLHttpRequest;
	var width = document.documentElement.clientWidth ;
	box.css("width",width);
	if( document.documentElement.clientHeight > document.body.scrollHeight ){
		var height = (document.body.scrollHeight-box.height()) /2 ;
	}else{
		var height = (document.documentElement.clientHeight-box.height()) /2 ;
	}
	
	if( isIE6 ){
		box.css({right:width,top:$(window).scrollTop()+210});
		$(window).scroll(function(){
			if( $(window).scrollTop() > document.body.scrollHeight-800 ){
				return false;
			}else{
				box.css({top: $(window).scrollTop()+210});		
			}
			//alert(  $(window).scrollTop() );
		});
	}else{
		box.css({right:width});
	}
	
}


